var xmlHttp; //定义XMLHttpRequest对象
function createXmlHttpRequestObject() {
	//如果在internet Explorer下运行
	if (window.ActiveXObject) {
		try {
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {
			xmlHttp = false;
		}

	} else {
		//如果在Mozilla或其他的浏览器下运行
		try {
			xmlHttp = new XMLHttpRequest();
		} catch (e) {
			xmlHttp = false;
		}
	}
	//返回创建的对象或显示错误信息
	if (!xmlHttp)
		alert("返回创建的对象或显示错误信息");
	else
		return xmlHttp;
}

function getinfo_id() {
	createXmlHttpRequestObject();
	var fix_id = document.getElementById("fix_id").value;
	if (fix_id == "") {
		alert('查询关键字不能为空！');
		return false;
	}
	xmlHttp.onreadystatechange = r_getinfo; //判断URL调用的状态值并处理
	xmlHttp.open("GET", 'php/get-fixinfo.php?action=searchbyid&fix_id=' + fix_id, false);
	xmlHttp.send(null);

}

function getinfo_time() {
	createXmlHttpRequestObject();
    A =document.getElementById("time_start").value;
    B =document.getElementById("time_end").value;
    if (A == "" && B == "") {
		alert('时间节点不能为空！');
		return false;
	}
    start = "1970-01-01 00:00:00";
    end = "2038-01-01 23:59:59";
    if(A != ""){
        start = A + " 00:00:00";
    }
    if(B != ""){
        end = B + " 23:59:59";
    }
	xmlHttp.onreadystatechange = r_getinfo; //判断URL调用的状态值并处理
	xmlHttp.open("GET", 'php/get-fixinfo.php?action=searchbytime&start=' + start + '&end=' + end, false);
	xmlHttp.send(null);
}


function r_getinfo() {
	if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
		document.getElementById("historylist").innerHTML = xmlHttp.responseText;
	}
}
